package com.pub.dialect;

public class OracleDialectImp implements DialectInterface{
	
	/*************
	 * 返回带限制的oracle字符串
	 */
	public String getLimitString(String sql, int pageNum ,int maxResult)
	{
		String prefix="select * from (";
		
		//计算起止条数
		if(pageNum<=0)
		{
			pageNum=1;
		}
		if(maxResult<=0)
		{
			maxResult=10;
		}
		int beginRow=pageNum*maxResult-maxResult;
		int endRow=pageNum*maxResult;
		
		String suffix=") where num>"+String.valueOf(beginRow)+"and num<="+String.valueOf(endRow);
		return prefix+sql+suffix;		
	}
	 public boolean supportsLimit() {
	        return true;
	 }


}
